package 对象之封装.买手机类;

//买手机
public class text {
    public static void main(String[] args) {
        MobilePhone p1 = new MobilePhone("小米11", "骁龙888", "12GB", "mivi 12", 6999);
        MobilePhone p2 = new MobilePhone("realme GT Neo", "天玑1200", "8GB", "android11", 1999);
        p1.printInfo();
        p2.printInfo();
        double totalprice = p1.getPrice() + p2.getPrice();
        System.out.println("这个人一共花了" + totalprice + "元");

    }

}

class MobilePhone {
    private String model;
    private String cpu;
    private String memory;
    private String os;
    private double price;

    public String getModel() {
        return model;
    }

    public void setModel(String model) {
        this.model = model;
    }

    public String getCpu() {
        return cpu;
    }

    public void setCpu(String cpu) {
        this.cpu = cpu;
    }

    public String getMemory() {
        return memory;
    }

    public void setMemory(String memory) {
        this.memory = memory;
    }

    public String getOs() {
        return os;
    }

    public void setOs(String os) {
        this.os = os;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    public MobilePhone(String model, String cpu, String memory, String os, double price) {
        this.model = model;
        this.cpu = cpu;
        this.memory = memory;
        this.os = os;
        this.price = price;
    }

    public double getPrice() {
        return price;
    }

    void printInfo() {
        System.out.println("品牌:" + model + ",cpu:" + cpu + ",内存容量" + memory + ",操作系统" + os + ",价钱+price");
    }
}

